package com.tencent.compose.video

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.interop.ArkUIView
import androidx.compose.ui.napi.js

@Composable
actual fun NetworkImage(
    imageUrl: String,
    contentDescription: String?,
    modifier: Modifier,
    contentScale: ContentScale
) {
    ArkUIView(
        name = "image",
        modifier = modifier,
        parameter = js {
            "src"(imageUrl)
            "objectFit"(when (contentScale) {
                ContentScale.FillBounds -> "cover"
                ContentScale.Crop -> "cover"
                ContentScale.Fit -> "contain"
                ContentScale.FillWidth -> "fill"
                ContentScale.FillHeight -> "fill"
                ContentScale.Inside -> "contain"
                ContentScale.None -> "none"
                else -> "cover"
            })
        }
    )
}

